package org.dawning.shop.category.entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * SKU类型
 */
@Data
public class Type {

    public Type() {
    }

    public Type(String typeName, String typeCode, Integer sort) {
        this.typeName = typeName;
        this.typeCode = typeCode;
        this.sort = sort;
    }

    /**
     * 属性类型名
     */
    private String typeName;
    /**
     * 属性类型code
     */
    private String typeCode;
    /**
     * 排序
     */
    private Integer sort;

    /**
     * SKU属性集合
     */
    private List<Attribute> attributeList;


    /**
     * 添加属性
     * @param attribute
     */
    public void addAttributeList(Attribute attribute) {
        if (this.attributeList ==null){
            attributeList = new ArrayList<>();
        }
        this.attributeList.add(attribute);
    }
}